module.exports = class extends think.kms.admin {

  constructor(ctx) {
    super(ctx);
    this.db = this.model('system_menu');
  }


  async indexAction() {
    let topMenu = [];
    const nodes = this.adminmenu;
    this.user = await this.session('userInfo');
    const menu = await this.model('kms/menu').getmenu(this.user.uid, this.is_admin);
    this.assign({
      alert: {
        title: '操作安全警告（默认新节点所有人可以访问，请勾选登录控制）',
        content: '其权限各选项直接影响到不同权限用户的访问及操作，请勿随意修改数据！',
        type: 'danger'
      },
      title: '系统节点管理',
      nodes: menu
    })
    return this.display();
  }

  async addAction() {
    if (this.isGet) {
      return this.display('admin/node_form');
    }
  }
};
